/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taskmanager;

import java.util.Date;

/**
 *
 * @author Pavel
 */
public class Task implements TaskInfo {
    
    private static int ordinal = 0;

    private String name;
    private boolean closed;
    private String contacts;
    private String description;
    private Date dueDate;
    private int id ;
    
    /**
     * Default constructor
     */

    public Task() {
        name = "";
        closed = false;
        contacts = "";
        description = "";
        dueDate = new Date();
        id = ++ordinal;
    }
    
    /**
     * Constructor
     * @param  name task name
     * @param  description  task description
     * @param  contacts task contacts
     * @param  date task due date
     */   
    public Task(String name, String description, String contacts, Date date) {
        this.name = name;
        closed = false;
        this.contacts = contacts;
        this.description = description;
        this.dueDate = date;
        id = ++ordinal;
    } 
    /**
     * Gets Name of task
     *   
     * @return Name of task    
     */
    public synchronized String getName() {
        return name;
    }
    /**
     * Sets Name of task
     *   
     * @param name Name of Task   
     */
    public synchronized void setName(String name) {
        this.name = name;
    }
    /**
     * Gets if task is closed
     *   
     * @return Status of task    
     */
    public synchronized boolean isClosed() {
        return closed;
    }
    
    /**
     *Sets status of task
     *   
     * @param isClosed Desired status  
     */
    public synchronized void setClosed(boolean isClosed) {
        this.closed = isClosed;
    }

    /**
     * Gets contacts of task
     *   
     * @return Contacts of task    
     */
    public synchronized String getContacts() {
        return contacts;
    }
    
    /**
     *Sets contacts of task
     *   
     * @param contacts      Contacts to be added to task
     */
    public synchronized void setContacts(String contacts) {
        this.contacts = contacts;
    }

    /**
     * Gets description of task
     *   
     * @return Description of task    
     */
    public synchronized String getDescription() {
        return description;
    }
    
    /**
     *Sets description of task
     *   
     * @param description      Description to be added to task
     */
    public synchronized void setDescription(String description) {
        this.description = description;
    }

    /**
     * Gets due date of task
     *   
     * @return Due date of task    
     */
    public synchronized Date getDueDate() {
        return dueDate;
    }
    
    
    /**
     * Sets due date of task
     *   
     * @param dueDate      Due date to be added to task
     */
    
    public synchronized void setDueDate(Date dueDate) {
        this.dueDate = dueDate;
    }
   
    /**
     * Gets ID of task
     *   
     * @return ID of task    
     */
    public int getId(){
        return id;
    }
}
